package com.ebupt.migu.globalpopup.enums;

import lombok.Getter;

@Getter
public enum OperatorEnum {
    FROPERTY_ENUM_1("01", "不清楚运营商类型"),
    FROPERTY_ENUM_2("02", "中国移动"),
    FROPERTY_ENUM_3("03", "中国联通"),
    FROPERTY_ENUM_4("04", "中国电信"),;
    final String code;
    final String name;

    OperatorEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getCodeByName(int code) {
        for (OperatorEnum v : values()) {
            if (v.getCode().equals(code) ) {
                return v.getName();
            }
        }
        return null;
    }

    public static String getNameByCode(String name) {
        for (OperatorEnum v : values()) {
            if (v.getName().equals(name)) {
                return v.getCode();
            }
        }
        return null;
    }
}
